#pragma once
#pragma comment(lib, "winmm.lib")
#include "Constants.h"
#include <string>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <windows.h>
#include <mmsystem.h>
#include <graphics.h>
using std::string;
using std::vector;
using std::ifstream;
using std::ofstream;
using std::cout;
using std::endl;
    
enum Orientaion {
	EAST,
	SOUTH,
	WEST,
	NORTH
};

enum Direction {
	FRONT,
	BACK,
	LEFT,
	RIGHT
};

struct Point {
    int x, y, z;
    int value;
};

class Map
{
public:
	static const int step[][2];
	int map[MAP_MAX_HEIGHT][MAP_MAX_WIDTH][MAP_MAX_WIDTH];


	Map();
    Map(bool isNew);

	void observe();
	void moveForward();
	void moveNoise(bool footsteop, bool door, bool tp);
	void turn(Direction direct);
	void mapRender();
    void saveAchieves();
	bool isOver();

	int getX();
	int getY();
	int getZ();
	int getOrientation();
private:
	static const COLORREF colors[3];
	bool isVisable[MAP_MAX_HEIGHT][MAP_MAX_WIDTH][MAP_MAX_WIDTH];

    vector<Point> portalEntrance;
    vector<Point> portalExit;


	vector<POINT> upStairs;
	vector<POINT> downStairs;
	int x, y, z;
	int orientation;

    // image resource
    IMAGE blank;
    IMAGE wall;
    IMAGE downstairs;
    IMAGE upstairs;

    IMAGE player[4];

    IMAGE portalRed;
    IMAGE portalBlue;
    IMAGE portalYellow;
};
